package com.atguigu.d_constructor;
/*
    创建对象的同时给属性赋值 !
        利用有参构造 , 在创建对象的同时给属性赋值 !
 */
public class Demo {
    public static void main(String[] args) {
        //创建Teacher对象
        Teacher teacher = new Teacher();
        System.out.println("teacher = " + teacher);
        teacher.setName("张老师");
        teacher.setAge(18);
        teacher.show();
        System.out.println("---------------");
        Teacher teacher1 = new Teacher("谈老师",18);
        System.out.println("teacher1 = " + teacher1);
        teacher1.show();

        System.out.println("---------------");
        teacher1.setAge(17);
        teacher1.show();


    }
}
